#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QEvent>
#include <QDebug>
#include <QKeyEvent>
#include <QWheelEvent>
#include <QMessageBox>
#include <QCloseEvent>
#include <QString>
#include <QEnterEvent>
#include "mytextedit.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class Widget;
}
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

protected:
    virtual void mouseDoubleClickEvent(QMouseEvent *event); // 双击事件
    virtual void mousePressEvent(QMouseEvent *event); // 按下事件
    virtual void mouseReleaseEvent(QMouseEvent *event); // 抬起事件
    virtual void enterEvent(QEnterEvent *event); // 移进窗口
    virtual void leaveEvent(QEvent *event); // 移出窗口
    virtual void wheelEvent(QWheelEvent *event); // 鼠标滚轮
    virtual void keyPressEvent(QKeyEvent *event); // 按键事件
    virtual void closeEvent(QCloseEvent *event); // 窗口关闭

    bool eventFilter(QObject *watched, QEvent *event);

private:
    Ui::Widget *ui;
    MyTextEdit *text;
};
#endif // WIDGET_H
